﻿using MyTodo.Common.Models;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace MyTodo.ViewModels
{
    public class IndexViewViewModel : BindableBase
    {
        public IndexViewViewModel()
        {
            taskBars = CreateTaskBars();

            todoDtos = CreateTodoDtos();
            memorDtos = CreateMemorDtos();
        }

        private ObservableCollection<MemorDto> CreateMemorDtos()
        {
            var memorDtos = new ObservableCollection<MemorDto>();
            for (int i = 0; i < 10; i++)
            {
                MemorDto todoDto = new();
                todoDto.Title = $"第{i}待办";
                todoDto.Description = $"第{i}待办描述";
                memorDtos.Add(todoDto);
            }
            return memorDtos;
        }

        private ObservableCollection<TodoDto> CreateTodoDtos()
        {
            var todos = new ObservableCollection<TodoDto>();
            for (int i = 0; i < 10; i++)
            {
                TodoDto todoDto = new();
                todoDto.Title = $"第{i}备忘录";
                todoDto.Description = $"第{i}备忘录描述";
                todos.Add(todoDto);
            }
            return todos;
        }

        private ObservableCollection<TaskBar> CreateTaskBars()
        {
            return new ObservableCollection<TaskBar> {
            new TaskBar(){ Icon="ClockEditOutline", Content="汇总", Title="9", Targate="" ,Color="#FF0CA0FF" },
            new TaskBar(){ Icon="ClockCheckOutline", Content="已完成", Title="8", Targate="" ,Color="#FF1ECA3A" },
            new TaskBar(){ Icon="ChartTimelineVariant", Content="完成比例", Title="89%", Targate="" ,Color="#FF02C6DC" },
            new TaskBar(){ Icon="CreditCardPlusOutline", Content="备忘录", Title="4", Targate="" ,Color="#FFFFA000" }};
        }

        private ObservableCollection<TaskBar> taskBars;

        public ObservableCollection<TaskBar> TaskBars
        {
            get { return taskBars; }
            set { taskBars = value; RaisePropertyChanged(); }
        }

        private ObservableCollection<TodoDto> todoDtos;

        public ObservableCollection<TodoDto> TodoDtos
        {
            get { return todoDtos; }
            set { todoDtos = value; RaisePropertyChanged(); }
        }

        private ObservableCollection<MemorDto> memorDtos;

        public ObservableCollection<MemorDto> MemorDtos
        {
            get { return memorDtos; }
            set { memorDtos = value; RaisePropertyChanged(); }
        }


    }
}




